package com.lagou.rpc.provider.interceptor;

import com.lagou.rpc.zk.ZKApi;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @Author Liu Chang
 * @Date 2021/10/19 1:33 上午
 */
@Component
public class Interceptor implements HandlerInterceptor {

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        String path = "/server/127.0.0.1:8899";
        Long content = System.currentTimeMillis();
        ZKApi.setNodeContent(path, content.toString());
    }
}
